package com.lc.rongzecaifu.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.lc.rongzecaifu.MyApplication;
import com.lc.rongzecaifu.conn.JsonBorrowout;
import com.lc.rongzecaifu.rongzecaifu.R;
import com.zcx.helper.bound.BoundViewHelper;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;


/**
 * Created by Administrator on 4/13/2016.
 */
public class SecondFailAdapter extends RecyclerView.Adapter<SecondFailAdapter.ViewHolder> {


    private Context context;
    private List<JsonBorrowout.Info.ListContent> list;


    public SecondFailAdapter(Context context, List<JsonBorrowout.Info.ListContent> list) {
        this.context = context;
        this.list = list;

    }


    public static class ViewHolder extends RecyclerView.ViewHolder {


        @Bind(R.id.tv_02)
        TextView tv_02;
        @Bind(R.id.tv_03)
        TextView tv_03;

        @Bind(R.id.money)
        TextView money;
        @Bind(R.id.tv_shuoming)
        TextView tv_shuoming;

        @Bind(R.id.tv_money)
        TextView tv_money;

        public ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }


    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = BoundViewHelper.boundView(this, MyApplication.scaleScreenHelper.loadView((ViewGroup) LayoutInflater.from(parent.getContext())
                .inflate(R.layout.item_borrowing_secondfaildata, null)));
        // set the view's size, margins, paddings and layout parameters
        SecondFailAdapter.ViewHolder vh = new SecondFailAdapter.ViewHolder(view);

        return vh;

    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position) {
        holder.tv_02.setText(list.get(position).borrow_name);
        holder.tv_03.setText(list.get(position).repayment_type_cn);
        holder.money.setText(list.get(position).borrow_money);
       // holder.progress.setText(list.get(position).progress);
holder.tv_shuoming.setText(list.get(position).dealinfo);

        holder.tv_money.setText(list.get(position).add_time);

    }

    @Override
    public int getItemCount() {
        return list.size();
    }
}
